package com.sinochem.yunlian.ship.base.rpc;

import com.sinochem.yunlian.ship.api.vo.bs.BsVersionVo;
import com.sinochem.yunlian.ship.base.biz.BsVersionBiz;
import com.sinochem.yunlian.ship.base.entity.BsVersion;
import com.sinochem.yunlian.ship.base.vo.response.RespBsVersionVo;
import com.sinochem.yunlian.ship.common.rest.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Auther: wangHui
 * @Dscription: 版本更新
 * @Date: Created in 11:21 2017/12/26
 **/
@Controller
@RestController
@RequestMapping(value = "/api/ver")
public class BsVersionRest extends BaseController<BsVersionBiz,BsVersion> {

    @Autowired
    private BsVersionBiz bsVersionBiz;

    /**
     * @Auther: wanghui
     * @Dscription: 根据 appId 获取版本信息
     * @Date: Created in 11:42 2017/12/26
     **/
    @RequestMapping(value = "/versionInfo/{appId}",method = RequestMethod.GET)
    public BsVersionVo getVersionInfoByAppId(@PathVariable("appId") String appId){
        BsVersion bsVersion = bsVersionBiz.getBsVersionByAppId(appId);
        BsVersionVo vo = new BsVersionVo();
        vo.setId(bsVersion.getId());
        vo.setAppId(bsVersion.getAppId());
        vo.setAppName(bsVersion.getAppName());
        vo.setClientVersion(bsVersion.getClientVersion());
        vo.setDownloadUrl(bsVersion.getDownloadUrl());
        vo.setRemark(bsVersion.getRemark());
        vo.setUpdateId(bsVersion.getUpdateId());
        vo.setUpdateTime(bsVersion.getUpdateTime());
        return vo;
    }

}
